-- Requires XFun readgray()
-- Any PICT file will be converted to an array of grayscale values at the resolution specified. For this example the source PICT is a color image 231 by 288.


-- read into a smaller array
width=80
height=100
readgray("test.PICT",width,height):

-- plot the array
Ystrips={1,1,.7}
Xmin=0; Xmax=width
Ymin=0; Ymax=height
Zmin=0; Zmax=255

image GrayArray

newaxis
image 255-GrayArray  -- calculate negative

-- A simple way to rearrange pixels is to define a new array that remaps index values. Given an index for the new array, calculate an index into the old one.

rotate(A)[ix,iy] = A[width-iy+1,ix] dim[height,width]

newaxis
Ymax:=width:
Xmax:=height:
image rotate(GrayArray)
